#include <iostream>
#include <stdlib.h>
using namespace std;

struct data{
	int id;
	char order;
	string time;
};
data src[10000];
int num=0;

void output();


int main()
{
	bool flag=true;
	while(1){
		while(1){
			cin>>src[num].id;
			if(src[num].id==-1){
				flag=false;
				break;
			}
			else{
				cin>>src[num].order>>src[num].time;
			}
			if(src[num].id==0){
				//num++;
				break;
			}
			else num++;
		}
		if(flag==false) break;
		output();
		num=0;
	}
}

void output()
{
	int cishu=0;
	int allTime=0;
	for(int i=0;i<num;i++){
		if(src[i].order=='S'){
			for(int j=i+1;j<num;j++){
				if(src[j].id==src[i].id&&src[j].order=='E'){
					cishu=cishu+1;
					char *p;
					
					int temp1=0,temp2=0;
					
					p=&src[i].time[0];
					temp1=atoi(p)*60;
					p=&src[i].time[3];
					temp1=temp1+atoi(p);
					
					p=&src[j].time[0];
					temp2=atoi(p)*60;
					p=&src[j].time[3];
					temp2=temp2+atoi(p);
					
					allTime=allTime+(temp2-temp1);
					
				}
				else continue;
			}
		}
	}
	float pingjun=0;
	int k=0;
	if(cishu!=0){
		pingjun=(float)allTime/cishu;
		k=pingjun+0.5;
		cout<<cishu<<" "<<k<<endl;
	}
	else cout<<0<<" "<<0<<endl;
}
